<template>
  <div class="app-container">
    <!-- 导航栏 -->
    <el-card style="margin-bottom: 16px" shadow="always" :body-style="{ padding: '0' }">
      <div style="display: flex; line-height: 30px">
        <h1
          v-for="(item, index) in navItems"
          :key="index"
          :class="{ DynamicCondition: isActive === index, spacing: index > 0 }"
          @click="clickToSwitch(index)"
          style="font-size: 15px; cursor: pointer"
        >
          {{ item }}
        </h1>
      </div>
    </el-card>

    <!-- 进度安排 -->
    <div v-show="isActive === 1" class="ProductionDynamic">
      <!-- 头部 -->
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform9" :searchImg="false" :formList="formList" @findClicked="findData3" />
      <!-- 主体 -->
      <el-card style="margin-top: 15px" class="ProductionDynamicMainCard" shadow="always" :body-style="{ padding: '5px' }">
        <div class="ProductionDynamicMain">
          <div style="width: 50%" class="ProductionDynamicMainCardMain">
            <h1 class="H1Size">订单资料</h1>
            <Table
              :isLoading="isLoading8"
              @selectList="selectList"
              @currentRow="currentRowListOeder"
              :tableData="OrderInformationInquiryTableDateList"
              :tableHeader="tableHeaderOuder"
              :selection="true"
              :TableHeight="80"
              :outTableHeight="50"
            />
            <PageModule
              :PageData="{ total: OrderTotal, buttonS: true, pageSizeShow: true }"
              :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange6"
              @pageChange="handleCurrentChange6"
            />
          </div>

          <div style="margin-left: 15px; width: 7%">
            <h1 class="H1Size">选择生产线</h1>
            <Table
              :isLoading="isLoading9"
              @currentRow="currentRowList"
              :tableData="WorkshopNameArrayList"
              :tableHeader="tableHeader15"
              :TableHeight="20"
              :outTableHeight="80"
            />
            <Find
              :OriginalFilter="{ static: true }"
              @Launchform="Launchform13"
              @findClicked="findData7"
              style="margin-left: 15px"
              :searchImg="false"
              :formList="formList11"
            />
          </div>

          <div style="margin-left: 15px; width: 42%" class="ProductionDynamicMainCardBorder">
            <h1 class="H1Size">
              进度安排资料 <el-button type="primary" size="small" @click="Topgo(1)">↑</el-button
              ><el-button type="primary" size="small" @click="Topgo(2)">↓</el-button>
            </h1>
            <div class="ProductionDynamicMainCardBorderLeft">
              <Table
                :isLoading="isLoading10"
                @inputChange="confirmChange10"
                @selectList="selectList1"
                @currentRow="currentRowTopGoToBottom"
                :tableData="progressQueryListTableDateList"
                :tableHeader="tableHeader1"
                :selection="true"
                :TableHeight="80"
                :outTableHeight="50"
              />
            </div>
          </div>
        </div>
      </el-card>
    </div>

    <!-- 基础资料建档 -->
    <div v-show="isActive === 0">
      <div style="margin-bottom: 16px">
        <Find :OriginalFilter="{ static: true }" @Launchform="Launchform7" :searchImg="false" :formList="formList2" @findClicked="findData1" />
      </div>

      <el-card shadow="always" :body-style="{ padding: '5px' }">
        <div class="Header">
          <div style="width: 25%">
            <h1 class="H1Size">
              成型生产线资料定义 <el-button type="primary" size="small" @click="dialogVisible1 = true">增</el-button>
              <el-button type="primary" size="small" @click="handleCloseMateriaLKlc">删</el-button>
            </h1>
            <Table
              :isLoading="isLoading7"
              @currentRow="currentRow1"
              @inputChange="confirmChange5"
              class="table1"
              :tableData="ProductionLineDataTableDateList"
              :tableHeader="tableHeader5"
              :TableHeight="40"
              :outTableHeight="200"
            />
          </div>
          <div style="width: 30%; margin-left: 15px">
            <h1 class="H1Size">
              学习曲线 <el-button type="primary" size="small" @click="dialogVisible2 = true">增</el-button>
              <el-button type="primary" size="small" @click="handleCloseMateriaLKlc1">删</el-button>
            </h1>
            <Table
              :isLoading="isLoading1"
              @inputChange="confirmChange1"
              @currentRow="currentRow2"
              :tableData="learningCurveDateTableDate"
              :tableHeader="tableHeader11"
              :TableHeight="40"
              :outTableHeight="210"
            />
          </div>
          <div style="width: 20%; margin-left: 15px">
            <h1 class="H1Size">
              型体IE资料建档 <el-button type="primary" size="small" @click="dialogVisible3 = true">增</el-button>
              <el-button type="primary" size="small" @click="handleCloseMateriaLKlc2">删</el-button>
            </h1>
            <Table
              :isLoading="isLoading2"
              @inputChange="confirmChange3"
              @currentRow="currentRow3"
              :tableData="styleDateListTableDateList"
              :tableHeader="tableHeader3"
              :TableHeight="40"
              :outTableHeight="210"
            />
            <PageModule
              :PageData="{ total: totalList, buttonS: true, pageSizeShow: true }"
              :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange"
              @pageChange="handleCurrentChange"
            />
          </div>
          <div style="width: 10%; margin-left: 15px">
            <h1 class="H1Size">
              节假日定义 <el-button type="primary" size="small" @click="dialogVisible4 = true">增</el-button>
              <el-button type="primary" size="small" @click="handleCloseMateriaLKlc3">删</el-button>
            </h1>
            <Table
              :isLoading="isLoading3"
              @inputChange="confirmChange4"
              @currentRow="currentRow4"
              :tableData="HolidayInquiryTableDateList"
              :tableHeader="tableHeader2"
              :TableHeight="40"
              :outTableHeight="210"
            />
            <PageModule
              :PageData="{ total: totalA, buttonS: true, pageSizeShow: true }"
              :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange1"
              @pageChange="handleCurrentChange1"
            />
          </div>
        </div>

        <div class="Header">
          <div class="H1Size" style="width: 20%; margin-top: 15px">
            <h1 class="H1Size">
              成型生产线生产产品定义 <el-button type="primary" size="small" @click="project">增</el-button>
              <el-button type="primary" size="small" @click="handleCloseMateriaLKlc4">删</el-button>
            </h1>
            <Table
              :isLoading="isLoading4"
              @selectValChange="confirmChange6"
              @inputChange="confirmChange6"
              @selectListShow="clickSelect"
              @currentRow="currentRow5"
              :tableData="projectTableDateTableDateList"
              :tableHeader="tableHeader6"
              :TableHeight="38"
            />
            <PageModule
              :PageData="{ total: totalAList, buttonS: true, pageSizeShow: true }"
              :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange2"
              @pageChange="handleCurrentChange2"
            />
          </div>

          <div style="width: 15%; margin-top: 15px; margin-left: 20px">
            <h1 class="H1Size">
              生产线日排量定义 <el-button type="primary" size="small" @click="project1">增</el-button>
              <el-button type="primary" size="small" @click="handleCloseMateriaLKlc5">删</el-button>
            </h1>
            <Table
              :isLoading="isLoading5"
              @selectValChange="confirmChange7"
              @selectListShow="clickSelect1"
              @inputChange="confirmChange7"
              @currentRow="currentRow6"
              :tableData="lineTableDateTableDateList"
              :tableHeader="tableHeader7"
              :TableHeight="38"
            />
            <PageModule
              :PageData="{ total: totalAList1, buttonS: true, pageSizeShow: true }"
              :layout="'prev, pager'"
              @pageSizeChange="handleSizeChange3"
              @pageChange="handleCurrentChange3"
            />
          </div>

          <div style="width: 40%; margin-top: 15px; margin-left: 20px">
            <h1 class="H1Size">时辰门槛天数定义</h1>
            <Table
              :isLoading="isLoading6"
              @inputChange="confirmChange8"
              :tableData="HourQueryTableDateList"
              :tableHeader="tableHeader8"
              :TableHeight="35"
            />
          </div>
        </div>
      </el-card>
    </div>

    <!-- 进度查询 -->
    <div v-show="isActive === 2">
      <div>
        <!-- 头部 -->
        <div>
          <Find :OriginalFilter="{ static: true }" :searchImg="false" :formList="formList1" @findClicked="findData5" @Launchform="Launchform8" />
        </div>

        <!-- 主体 -->
        <div style="margin-top: 15px">
          <el-card shadow="always" :body-style="{ padding: '5px' }">
            <!-- card body -->
            <!-- 表格 -->
            <div>
              <div>
                <h1 class="H1Size">材料订购明细</h1>
                <Table
                  :isLoading="isLoading"
                  :tableData="progressQueryTableDateList"
                  :tableHeader="tableHeader"
                  :selection="false"
                  :TableHeight="89"
                />
                <PageModule
                  :PageData="{ total: totalListKlc, buttonS: true, pageSizeShow: true }"
                  :layout="'prev, pager'"
                  @pageSizeChange="handleSizeChange5"
                  @pageChange="handleCurrentChange5"
                />
              </div>
            </div>
          </el-card>
        </div>
      </div>
    </div>

    <!-- 成型生产资料定义新增 -->
    <el-dialog v-model="dialogVisible1" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform" @findClicked="findClicked1" :searchImg="false" :formList="formList5" />
    </el-dialog>

    <!-- 学习曲线新增 -->
    <el-dialog v-model="dialogVisible2" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform2" @findClicked="findClicked2" :searchImg="false" :formList="formList6" />
    </el-dialog>

    <!-- IE新增 -->
    <el-dialog v-model="dialogVisible3" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform3" @findClicked="findClicked3" :searchImg="false" :formList="formList7" />
    </el-dialog>

    <!-- IE新增 -->
    <el-dialog v-model="dialogVisible4" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform4" @findClicked="findClicked4" :searchImg="false" :formList="formList8" />
    </el-dialog>

    <!-- 产品新增 -->
    <el-dialog v-model="dialogVisible5" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform5" @findClicked="findClicked5" :searchImg="false" :formList="formList9" />
    </el-dialog>

    <!-- 产品新增 -->
    <el-dialog v-model="dialogVisible6" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform6" @findClicked="findClicked6" :searchImg="false" :formList="formList10" />
    </el-dialog>

    <!-- 批量移线 -->
    <el-dialog v-model="dialogVisible7" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform11" @findClicked="findClicked11" :searchImg="false" :formList="formList12" />
    </el-dialog>

    <!-- 批量改序 -->
    <el-dialog v-model="dialogVisible8" width="50%" class="dialog pb0">
      <Find :OriginalFilter="{ static: true }" @Launchform="Launchform12" @findClicked="findClicked12" :searchImg="false" :formList="formList13" />
    </el-dialog>
  </div>
</template>
<script lang="ts">
import { defineComponent, ref, onMounted } from 'vue'
import JMessage from '@/utils/JMessage'
export default defineComponent({
  name: 'FormingPre'
})
</script>
<script lang="ts" setup>
import { i18n, Jzhcn } from '@/i18n'
import {
  CalculatingProgress,
  BatchNumbering,
  BulkLineShift,
  deleteScheduleDate,
  scheduleDate,
  scheduleDateAdd,
  BottomGotoTop,
  updateLotNo,
  orderStyle,
  progressQueryList,
  OrderInformationInquiry,
  styleQuery,
  progressQuery,
  dateListLo,
  HourQuery,
  deletedisplacement,
  addisplacement,
  ProductionLineData,
  styleDateList,
  learningCurveDate,
  HolidayInquiry,
  projectTableDate,
  lineTableDate,
  AddProduction,
  removeDate,
  Addlearning,
  removelearning,
  AddIEDate,
  removeIe,
  AddHolidays,
  deleteHolidays,
  addProject,
  deleteProJect
} from '@/api/Control/FactoryControl/FormingPre'
import LoginWork from '@/utils/LoginWork'
import { ElMessage, ElMessageBox } from 'element-plus'

// 表格状态
const isLoading1 = ref(true)

const isLoading2 = ref(true)

const isLoading3 = ref(true)

const isLoading4 = ref(true)

const isLoading5 = ref(true)

const isLoading6 = ref(true)

const isLoading7 = ref(true)

const isLoading8 = ref(true)

const isLoading9 = ref(true)

const isLoading10 = ref(true)

//IE修改
const confirmChange10 = async (row?: any) => {
  const result = await LoginWork.post<any, any>(`/bioDeptWrok/scheduleHeadUp?stdQty=${row.stdQty}&lotNo=${row.lotNo}`)
  if (result.code === 200) {
    progressQueryListMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 计算进度表
const timeList = ref('')

const formatCurrentDate = (date?: any) => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  return `${year}-${month}-${day}`
}

const CalculatingProgressMethods = async () => {
  const result = await CalculatingProgress(timeList.value === '' ? formatCurrentDate(new Date()) : timeList.value)
  if (result.code === 200) {
    progressQueryListMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const Launchform13 = (row: any) => {
  timeList.value = row[4].dateValue
}

const dialogVisible8 = ref(false)

const Launchform12 = (row: any) => {
  BatchNumberingParms.value.targetSeqNo = Number(row[0].inputValue)
}

const findClicked12 = (count: string) => {
  if (count === '调整序号') {
    if (BatchNumberingParms.value.targetSeqNo === -1) {
      JMessage.warning('请输入需要改的位置')
    }
    BatchNumberingMehtods()
  }
}

// 批量改序号
const BatchNumberingParms = ref({
  line: '',
  seqNo: [],
  targetLine: '',
  targetSeqNo: -1,
  type: ''
})

const BatchNumberingMehtods = async () => {
  const result = await BatchNumbering(BatchNumberingParms.value)
  if (result.code === 200) {
    progressQueryListMethods()
    dialogVisible8.value = false
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const Launchform11 = (row: any) => {
  BulkLineShiftMethodsParms.value.targetLine = row[0].selectValue
}

const findClicked11 = (count: string) => {
  if (count === '调整') {
    if (BulkLineShiftMethodsParms.value.targetLine === '') {
      JMessage.warning('请选择正确的生产线')
    } else {
      BulkLineShiftMethods()
    }
  }
}

const dialogVisible7 = ref(false)

// 批量移线
const BulkLineShiftMethodsParms = ref({
  line: '',
  seqNo: [],
  targetLine: '',
  targetSeqNo: '',
  type: ''
})

const BulkLineShiftMethods = async () => {
  const result = await BulkLineShift(BulkLineShiftMethodsParms.value)
  if (result.code === 200) {
    progressQueryListMethods()
    dialogVisible7.value = false
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

//取消安排删除
const deleteLotNoList = ref([])

const deleteScheduleDateMethdos = async () => {
  if (deleteLotNoList.value.length === 0) {
    JMessage.warning('请选择需要取消安排的数据')
  } else {
    const result = await deleteScheduleDate(deleteLotNoList.value)
    if (result.code === 200) {
      progressQueryListMethods()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  }
}

const selectList1 = (selectList: any) => {
  deleteLotNoList.value = selectList.map((itme: any) => {
    return itme.lotNo
  })
  BulkLineShiftMethodsParms.value.seqNo = selectList.map((itme: any) => {
    return itme.seqNo
  })

  BatchNumberingParms.value.seqNo = selectList.map((itme: any) => {
    return itme.seqNo
  })
}

// 安排进度
const scheduleDateMethods = async () => {
  const result = await scheduleDate()
  if (result.code === 200) {
    progressQueryListMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const findData7 = (count: string) => {
  switch (count) {
    case '取消安排': {
      deleteScheduleDateMethdos()
      break
    }
    case '安排进度': {
      scheduleDateMehtods()
      break
    }
    case '取进度表资料': {
      scheduleDateMethods()
      break
    }
  }
}

// 进度安排新增
const line1List = ref('')

const lotNoArrayList = ref([])

const scheduleDateMehtods = async () => {
  if (line1List.value === '') {
    JMessage.warning('请选择要需要安排进度的线')
  } else if (lotNoArrayList.value.length === 0) {
    JMessage.warning('请从订单资料中勾选对应的数据')
  } else {
    const result = await scheduleDateAdd(line1List.value, lotNoArrayList.value)
    if (result.code === 200) {
      progressQueryListMethods()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  }
}

const selectList = (selectList: any) => {
  lotNoArrayList.value = selectList.map((itme: any) => {
    return itme.lotNo
  })
}

const formList11 = ref([
  {
    type: 'button',
    checkboxLabel: '安排进度'
  },
  {
    type: 'button',
    checkboxLabel: '取消安排'
  },
  {
    type: 'button',
    checkboxLabel: '拆分安排'
  },
  {
    type: 'button',
    checkboxLabel: '自动安排'
  },
  {
    type: 'dateSingle',
    dateLabel: '',
    dateValue: '',
    width: '55'
  },
  {
    type: 'button',
    checkboxLabel: '取进度表资料'
  }
])

const Topgo = (list: number) => {
  if (BottomGotoTopParms.value.seqNo.length === 0) {
    JMessage.warning('请选择需要移动的数据')
  } else {
    if (list === 1) {
      BottomGotoTopParms.value.type = -1
      BottomGotoTopMethods()
    } else {
      BottomGotoTopParms.value.type = 1
      BottomGotoTopMethods()
    }
  }
}

const currentRowTopGoToBottom = (row: any) => {
  BottomGotoTopParms.value.seqNo = []
  const { seqNo } = row
  BottomGotoTopParms.value.seqNo.push(seqNo)
}

const BottomGotoTopParms = ref<any>({
  line: '',
  seqNo: [],
  targetLine: '',
  targetSeqNo: '',
  type: 0
})

// 上下移动
const BottomGotoTopMethods = async () => {
  const result = await BottomGotoTop(BottomGotoTopParms.value)
  if (result.code === 200) {
    progressQueryListMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 更新指令
const updateLotNoMethods = async () => {
  const result = await updateLotNo()
  if (result.code === 200) {
    OrderInformationInquiryMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 指令结束/回复
const schFlagList = ref('')

const lotNoListArray = ref('')

const currentRowListOeder = (row: any) => {
  const { lotNo } = row
  lotNoListArray.value = lotNo
}

const handleCloseMateriaLKlc9 = () => {
  if (lotNoListArray.value === '') {
    JMessage.warning(`请选择需要指令${HitText.value}的数据`)
  } else {
    ElMessageBox.confirm(`确定要指令${HitText.value}该数据吗?`)
      .then(async () => {
        orderStyleMethods()
      })
      .catch(() => {})
  }
}

const HitText = ref('')

const orderStyleMethods = async () => {
  const result = await orderStyle(lotNoListArray.value, schFlagList.value)
  if (result.code === 200) {
    OrderInformationInquiryMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const findData3 = (count: string) => {
  switch (count) {
    case '指令结束': {
      schFlagList.value = 'Y'
      HitText.value = '结束'
      handleCloseMateriaLKlc9()
      break
    }
    case '指令恢复': {
      schFlagList.value = 'N'
      HitText.value = '恢复'
      handleCloseMateriaLKlc9()
      break
    }
    case '查看结束指令': {
      OrderInformationInquiryParms.value.lotFlag = 0
      OrderInformationInquiryMethods()
      break
    }
    case '更新指令': {
      updateLotNoMethods()
      break
    }
    case '批量移线': {
      if (BulkLineShiftMethodsParms.value.seqNo.length === 0) {
        JMessage.warning('请选择需要移动的数据')
      } else {
        formList12.value[0].selectOptions = EvaluatesTheArrayReturnValue(WorkshopNameArray.value)
        dialogVisible7.value = true
      }

      break
    }
    case '批量改序号': {
      if (BatchNumberingParms.value.seqNo.length === 0) {
        JMessage.warning('请选择需要移动的数据')
      } else {
        dialogVisible8.value = true
      }
    }
    case '计算进度表': {
      CalculatingProgressMethods()
      break
    }
  }
}

const currentRowList = (row: any) => {
  const { optionValue } = row
  lineListArray.value = optionValue
  line1List.value = optionValue
  BulkLineShiftMethodsParms.value.line = optionValue
  BatchNumberingParms.value.line = optionValue
  progressQueryListMethods()
}

// 进度资料查询
const lineListArray = ref('')
const LotNoList = ref('')
const styleListArray = ref('')

const progressQueryListTableDateList = ref([])

const progressQueryListMethods = async () => {
  const result = await progressQueryList(lineListArray.value, LotNoList.value, styleListArray.value)
  progressQueryListTableDateList.value = result.dtos.map((item: any) => {
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  isLoading10.value = false
}

// 订单资料查询
const OrderInformationInquiryParms = ref({
  beginDateEnd: '',
  beginDateStart: '',
  deliveryDateEnd: '',
  deliveryDateStart: '',
  line: '',
  lotFlag: 1,
  lotNo: '',
  ordFlag: '',
  ordName: '',
  pageNum: 1,
  pageSize: 40,
  style: ''
})

const Launchform9 = (row: any) => {
  OrderInformationInquiryParms.value.lotNo = row[0].inputValue
  OrderInformationInquiryParms.value.style = row[1].selectValue
  OrderInformationInquiryParms.value.deliveryDateStart = row[2].dateValue[0]
  OrderInformationInquiryParms.value.deliveryDateEnd = row[2].dateValue[1]
  OrderInformationInquiryMethods()
  LotNoList.value = row[13].inputValue
  styleListArray.value = row[14].inputValue
  progressQueryListMethods()
}

const OrderInformationInquiryTableDateList = ref([])

const OrderTotal = ref(0)

const OrderInformationInquiryMethods = async () => {
  const result = await OrderInformationInquiry(OrderInformationInquiryParms.value)
  OrderInformationInquiryTableDateList.value = result.dtos
  OrderTotal.value = result.total
  isLoading8.value = false
}

const handleSizeChange6 = (val: number) => {
  OrderInformationInquiryParms.value.pageSize = val
  OrderInformationInquiryMethods()
}

const handleCurrentChange6 = (val: number) => {
  OrderInformationInquiryParms.value.pageNum = val
  OrderInformationInquiryMethods()
}

const Launchform8 = (row: any) => {
  progressQueryParms.value.line = row[0].selectValue
  progressQueryParms.value.lotNo = row[1].inputValue
  progressQueryParms.value.style = row[2].selectValue
  progressQueryParms.value.deliveryDateStart = row[3].dateValue[0]
  progressQueryParms.value.deliveryDateEnd = row[3].dateValue[1]
  progressQueryParms.value.beginDateStart = row[4].dateValue[0]
  progressQueryParms.value.beginDateEnd = row[4].dateValue[1]
  progressQueryMethods()
}

const styleQueryMethods = async () => {
  let result = await styleQuery()

  formList1.value[2].selectOptions = EvaluatesTheArrayReturnValue(result.filter((item: any) => item !== null))
  formList.value[1].selectOptions = formList1.value[2].selectOptions
}

const isLoading = ref(true)

const findData5 = (row: any) => {
  if (row === '置空') {
    clearFormList2()
  }
}

const clearFormList2 = () => {
  formList1.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    } else if (item.type === 'select') {
      item.selectValue = ''
    } else if (item.type === 'date') {
      item.dateValue = ''
    }
  })
}

// 进度查询
const progressQueryParms = ref({
  beginDateEnd: '',
  beginDateStart: '',
  deliveryDateEnd: '',
  deliveryDateStart: '',
  line: '',
  lotFlag: '',
  lotNo: '',
  ordFlag: '',
  ordName: '',
  pageNum: 1,
  pageSize: 40,
  style: ''
})

const progressQueryTableDateList = ref([])

const totalListKlc = ref(0)

const progressQueryMethods = async () => {
  const result = await progressQuery(progressQueryParms.value)
  progressQueryTableDateList.value = result.dtos
  totalListKlc.value = result.total
  isLoading.value = false
}

const handleSizeChange5 = (val: number) => {
  progressQueryParms.value.pageSize = val
  progressQueryMethods()
}

const handleCurrentChange5 = (val: number) => {
  progressQueryParms.value.pageNum = val
  progressQueryMethods()
}

// 插入排量资料
const dateListD = ref('')

const clearFormList1 = () => {
  formList2.value.forEach((item) => {
    if (item.type === 'input') {
      item.inputValue = ''
    } else if (item.type === 'select') {
      item.selectValue = ''
    } else if (item.type === 'dateSingle') {
      item.dateValue = ''
    }
  })
}

const dateListMethods = async () => {
  if (dateListD.value === '') {
    JMessage.warning('月份不可为空!!!')
  } else {
    const result = await dateListLo(dateListD.value)
    if (result.code === 200) {
      lineTableDateMehtods()
      JMessage.success(result.message)
    } else {
      JMessage.error(result.message)
    }
  }
}

const dateList = ref('')
const lineList = ref('')

const findData1 = (count: string) => {
  switch (count) {
    case '插入下一个月周日日期': {
      addMondy()
      break
    }
    case '插入一个月日排量资料': {
      dateListMethods()
      break
    }
    case '置空': {
      clearFormList1()
      break
    }
  }
}

const addMondy = async () => {
  const result = await LoginWork.post<any, any>(`/bioDeptWrok/monthHolidayAdd`)
  if (result.code === 200) {
    HolidayInquiryMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 型体查询
const styleList = ref('')

const Launchform7 = (row: any) => {
  styleList.value = row[0].inputValue
  lineList.value = row[2].selectValue
  dateList.value = row[3].dateValue
  dateListD.value = row[4].inputValue
  styleDateListMethods()
  lineTableDateMehtods()
}

// 时辰修改
const confirmChange8 = async (row?: any) => {
  row.soleMtlLt = Number(row.soleMtlLt)
  row.cut1MtlLt = Number(row.cut1MtlLt)
  row.cut2MtlLt = Number(row.cut2MtlLt)
  row.stitchMtlLt = Number(row.stitchMtlLt)
  row.cut4MtlLt = Number(row.cut4MtlLt)
  const result = await LoginWork.put<any, any>('/bioDeptWrok/ltCommonUpdate', row)
  if (result.code === 200) {
    HourQueryMehtods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 时辰查询
const HourQueryTableDateList = ref<any>([])

const HourQueryMehtods = async () => {
  const result = await HourQuery()
  HourQueryTableDateList.value = [
    Object.entries(result)
      .map(([item, value]) => {
        return { [item]: value }
      })
      .reduce((obj, item) => {
        return { ...obj, ...item }
      }, {})
  ].map((item: any) => {
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  isLoading6.value = false
}

const WorkshopNameArray = ref<any>([])

const formList10 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '请选择生产线',
    selectLabel: '',
    selectOptions: []
  },
  {
    type: 'dateSingle',
    dateLabel: '请选择日期',
    dateValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '排量',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'button',
    checkboxLabel: '确认添加'
  }
])

const formList12 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '新生产线',
    selectLabel: '',
    selectOptions: []
  },
  {
    type: 'input',
    inputPlaceholder: '序号',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'button',
    checkboxLabel: '调整'
  }
])

const formList13 = ref([
  {
    type: 'input',
    inputPlaceholder: '新序号',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'button',
    checkboxLabel: '调整序号'
  }
])

// 产品修改
const clickSelect1 = (visible: any, row: any) => {
  if (row) {
    visible.line.options = EvaluatesTheArrayReturnValue1(WorkshopNameArray.value)
  } else {
    if (typeof visible.line === 'object') {
      visible.line.options = []
    }
  }
}

// 产品修改
const confirmChange7 = async (row?: any) => {
  row.line = row.line.selectValue
  const result = await LoginWork.put<any, any>('/bioDeptWrok/dayPercentUpdate', row)
  if (result.code === 200) {
    lineTableDateMehtods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 产线删除
const idlist1 = ref('')

const currentRow6 = (row: any) => {
  const { id } = row
  idlist1.value = id
}

const handleCloseMateriaLKlc5 = () => {
  if (idlist1.value === '') {
    JMessage.warning('请选择需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        deletedisplacementMehtods()
      })
      .catch(() => {})
  }
}

const deletedisplacementMehtods = async () => {
  const result = await deletedisplacement(idlist1.value)
  if (result.code === 200) {
    lineTableDateMehtods()
    idlist1.value = ''
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 产线日排 新增
const dialogVisible6 = ref(false)

const Launchform6 = (row: any) => {
  addisplacementPamrs.value.line = row[0].selectValue
  addisplacementPamrs.value.ddate = row[1].dateValue
  addisplacementPamrs.value.percent = Number(row[2].inputValue)
}

const findClicked6 = (count: string) => {
  if (count === '确认添加') {
    addisplacementMethods()
  }
}

const project1 = () => {
  dialogVisible6.value = true
  formList10.value[0].selectOptions = EvaluatesTheArrayReturnValue(WorkshopNameArray.value)
}

const addisplacementPamrs = ref({
  ddate: '',
  line: '',
  id: 0,
  percent: 0
})

const addisplacementMethods = async () => {
  const result = await addisplacement(addisplacementPamrs.value)
  if (result.code === 200) {
    lineTableDateMehtods()
    JMessage.success(result.message)
    dialogVisible6.value = false
  } else {
    JMessage.error(result.message)
  }
}

// 产品修改
const confirmChange6 = async (row?: any) => {
  row.line = row.line.selectValue
  const result = await LoginWork.put<any, any>('/bioDeptWrok/customUpdate', row)
  if (result.code === 200) {
    projectTableDateMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const EvaluatesTheArrayReturnValue1 = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      value: item,
      label: item
    }
  })
}

// 产品修改
const clickSelect = (visible: any, row: any) => {
  if (row) {
    visible.line.options = EvaluatesTheArrayReturnValue1(WorkshopNameArray.value)
  } else {
    if (typeof visible.line === 'object') {
      visible.line.options = []
    }
  }
}

// 产品删除
const idlist = ref('')

const currentRow5 = (row: any) => {
  const { id } = row
  idlist.value = id
}

const handleCloseMateriaLKlc4 = () => {
  if (idlist.value === '') {
    JMessage.warning('请选择需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        deleteProJectMehtods()
      })
      .catch(() => {})
  }
}

const deleteProJectMehtods = async () => {
  const result = await deleteProJect(idlist.value)
  if (result.code === 200) {
    projectTableDateMethods()
    idlist.value = ''
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const formList9 = ref([
  {
    type: 'select',
    selectValue: '',
    selectP: '请选择线别',
    selectLabel: '',
    selectOptions: []
  },
  {
    type: 'input',
    inputPlaceholder: '请输入客户',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入品牌',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入系列',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'button',
    checkboxLabel: '确认添加'
  }
])

const Launchform5 = (row: any) => {
  addProjectParms.value.line = row[0].selectValue
  addProjectParms.value.custom = row[1].inputValue
  addProjectParms.value.brand = row[2].inputValue
  addProjectParms.value.productType = row[3].inputValue
}

const findClicked5 = (count: string) => {
  if (count === '确认添加') {
    addProjectMethods()
  }
}

const project = () => {
  dialogVisible5.value = true
  formList9.value[0].selectOptions = EvaluatesTheArrayReturnValue(WorkshopNameArray.value)
}

const EvaluatesTheArrayReturnValue = (ArrayList: any) => {
  return ArrayList.map((item: any, index: any) => {
    return {
      optionKey: index,
      optionValue: item,
      optionLabel: item
    }
  })
}

// 产品定义新增
const dialogVisible5 = ref(false)

const addProjectParms = ref({
  brand: '',
  custom: '',
  id: 0,
  line: '',
  productType: ''
})

const addProjectMethods = async () => {
  const result = await addProject(addProjectParms.value)
  if (result.code === 200) {
    projectTableDateMethods()
    JMessage.success(result.message)
    dialogVisible5.value = false
  } else {
    JMessage.error(result.message)
  }
}

// 节假日修改
const confirmChange4 = async (row?: any) => {
  row.holidayDateOld = dialogVisible4Parms.value
  const result = await LoginWork.put<any, any>('/bioDeptWrok/holidayUpdate', row)
  if (result.code === 200) {
    HolidayInquiryMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 节假日删除
const currentRow4 = (row: any) => {
  const { holidayDate } = row
  dialogVisible4Parms.value = holidayDate
}

const dialogVisible4Parms = ref('')

const deleteHolidaysMehtods = async () => {
  const result = await deleteHolidays(dialogVisible4Parms.value)
  if (result.code === 200) {
    HolidayInquiryMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const handleCloseMateriaLKlc3 = () => {
  if (dialogVisible4Parms.value === '') {
    JMessage.warning('请选择需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        deleteHolidaysMehtods()
      })
      .catch(() => {})
  }
}

// 节假日新增
const formList8 = ref([
  {
    type: 'dateSingle',
    dateLabel: '节假日',
    dateValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '确认添加'
  }
])

const dialogVisible4 = ref(false)

const AddHolidaysParms = ref({
  holidayDate: ''
})

const AddHolidaysMehtods = async () => {
  const result = await AddHolidays(AddHolidaysParms.value)
  if (result.code === 200) {
    HolidayInquiryMethods()
    JMessage.success(result.message)
    dialogVisible4.value = false
  } else {
    JMessage.error(result.message)
  }
}

const Launchform4 = (row: any) => {
  AddHolidaysParms.value.holidayDate = row[0].dateValue
}

const findClicked4 = (row: string) => {
  if (row === '确认添加') {
    AddHolidaysMehtods()
  }
}

const formList7 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入型体',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输成型日产能',
    inputValue: '',
    inputLabel: ''
  },

  {
    type: 'button',
    checkboxLabel: '确认添加'
  }
])

const dialogVisible3 = ref(false)

// IE修改
const confirmChange3 = async (row?: any) => {
  row.styleOld = IEStyle.value
  row.ieQty = Number(row.ieQty)
  const result = await LoginWork.put<any, any>('/bioDeptWrok/iEUpdate', row)
  if (result.code === 200) {
    styleDateListMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// IE删除
const IEStyle = ref('')

const currentRow3 = (row: any) => {
  const { style } = row
  IEStyle.value = style
}

const removeIeMethods = async () => {
  const result = await removeIe(IEStyle.value)
  if (result.code === 200) {
    styleDateListMethods()
    IEStyle.value = ''
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const handleCloseMateriaLKlc2 = () => {
  if (IEStyle.value === '') {
    JMessage.warning('请选择需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        removeIeMethods()
      })
      .catch(() => {})
  }
}

// IE新增
const AddIEDateParms = ref({
  ieQty: 0,
  style: ''
})

const Launchform3 = (row: any) => {
  AddIEDateParms.value.ieQty = Number(row[0].inputValue)
  AddIEDateParms.value.style = row[1].inputValue
}

const findClicked3 = (count: string) => {
  if (count === '确认添加') {
    AddIEDateMehtods()
  }
}

const AddIEDateMehtods = async () => {
  const result = await AddIEDate(AddIEDateParms.value)
  if (result.code === 200) {
    styleDateListMethods()
    JMessage.success(result.message)
    dialogVisible3.value = false
  } else {
    JMessage.error(result.message)
  }
}

// 学习曲线新增
const formList6 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入型体',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入序号',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '从',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '到',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '排量%',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'dateSingle',
    dateLabel: '第一次投量日期',
    dateValue: ''
  },

  {
    type: 'button',
    checkboxLabel: '确认添加'
  }
])

const confirmChange1 = async (row?: any) => {
  const result = await LoginWork.put<any, any>('/bioDeptWrok/curveUpdate', row)
  if (result.code === 200) {
    learningCurveDateMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

// 删除
const idRemove = ref('')

const currentRow2 = (row: any) => {
  const { id } = row
  idRemove.value = id
}

const removelearningMehtods = async () => {
  const result = await removelearning(idRemove.value)
  if (result.code === 200) {
    learningCurveDateMethods()
    idRemove.value = ''
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const handleCloseMateriaLKlc1 = () => {
  if (idRemove.value === '') {
    JMessage.warning('请选择需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        removelearningMehtods()
      })
      .catch(() => {})
  }
}

const dialogVisible2 = ref(false)

const AddlearningParms = ref({
  beginDate: '',
  dayFrom: 0,
  dayTo: 0,
  id: '',
  percent: 0,
  seqNo: 0,
  style: ''
})

const AddlearningMethods = async () => {
  const result = await Addlearning(AddlearningParms.value)
  if (result.code === 200) {
    learningCurveDateMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const Launchform2 = (row: any) => {
  AddlearningParms.value.style = row[0].inputValue
  AddlearningParms.value.seqNo = Number(row[1].inputValue)
  AddlearningParms.value.dayFrom = Number(row[2].inputValue)
  AddlearningParms.value.dayTo = Number(row[3].inputValue)
  AddlearningParms.value.percent = Number(row[4].inputValue)
  AddlearningParms.value.beginDate = row[5].dateValue
}

const findClicked2 = (count: string) => {
  if (count === '确认添加') {
    AddlearningMethods()
  }
}

// 成型删除
const removeDateMethods = async () => {
  const result = await removeDate(workshop1.value)
  if (result.code === 200) {
    ProductionLineDataMethods()
    workshop1.value = ''
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const handleCloseMateriaLKlc = () => {
  if (workshop1.value === '') {
    JMessage.warning('请选择需要删除的数据')
  } else {
    ElMessageBox.confirm('确认要删除数据吗?')
      .then(async () => {
        removeDateMethods()
      })
      .catch(() => {})
  }
}

// 成型资料生成定义 新增
const currentRow1 = (row: any) => {
  const { workshop } = row
  workshop1.value = workshop
}

const workshop1 = ref('')

// 修改贴合材料
const confirmChange5 = async (row?: any) => {
  row.workshopOld = workshop1.value
  row.ppdQty = ''
  row.persons = Number(row.persons)
  const result = await LoginWork.put<any, any>('/bioDeptWrok/lineUpdate', row)
  if (result.code === 200) {
    ProductionLineDataMethods()
    JMessage.success(result.message)
  } else {
    JMessage.error(result.message)
  }
}

const Launchform = (row: any) => {
  AddProductionMethodsPamrs.value.seqNo = Number(row[0].inputValue)
  AddProductionMethodsPamrs.value.workshop = row[1].inputValue
  AddProductionMethodsPamrs.value.line = row[2].inputValue
  AddProductionMethodsPamrs.value.workshopName = row[3].inputValue
  AddProductionMethodsPamrs.value.ieQty = Number(row[4].inputValue)
  AddProductionMethodsPamrs.value.persons = Number(row[5].inputValue)
}

const findClicked1 = (count: string) => {
  if (count === '确认添加') {
    AddProductionMethods()
  }
}

const dialogVisible1 = ref(false)

const AddProductionMethodsPamrs = ref({
  ieQty: 0,
  line: '',
  persons: 0,
  ppdQty: '',
  seqNo: 0,
  workshop: '',
  workshopName: ''
})

const AddProductionMethods = async () => {
  const result = await AddProduction(AddProductionMethodsPamrs.value)
  if (result.code === 200) {
    JMessage.success(result.message)
    dialogVisible1.value = false
    ProductionLineDataMethods()
  } else {
    JMessage.error(result.message)
  }
}

const formList5 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入序号',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入车间代码',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入车间名称',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入生产线名称',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '日产能双(双)',
    inputValue: '',
    inputLabel: ''
  },
  {
    type: 'input',
    inputPlaceholder: '人数',
    inputValue: '',
    inputLabel: ''
  },

  {
    type: 'button',
    checkboxLabel: '确认添加'
  }
])

// 生产线日排量定义
const lineTableDateParms = ref({
  pageNum: 1,
  pageSize: 40
})

const totalAList1 = ref(0)

const lineTableDateTableDateList = ref([])

const lineTableDateMehtods = async () => {
  const result = await lineTableDate(lineTableDateParms.value, dateList.value, lineList.value)
  totalAList1.value = result.total
  lineTableDateTableDateList.value = result.dtos.map((item: any) => {
    item.line = {
      selectValue: item.line || '',
      options: []
    }
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  isLoading5.value = false
}

const handleSizeChange3 = (val: number) => {
  lineTableDateParms.value.pageSize = val
  lineTableDateMehtods()
}

const handleCurrentChange3 = (val: number) => {
  lineTableDateParms.value.pageNum = val
  lineTableDateMehtods()
}

// 成型产品定义查询
const projectTableDateParms = ref({
  pageNum: 1,
  pageSize: 40
})

const totalAList = ref(0)

const projectTableDateTableDateList = ref([])

const projectTableDateMethods = async () => {
  const result = await projectTableDate(projectTableDateParms.value)
  totalAList.value = result.total
  projectTableDateTableDateList.value = result.dtos.map((item: any) => {
    item.line = {
      selectValue: item.line || '',
      options: []
    }
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  isLoading4.value = false
}

const handleSizeChange2 = (val: number) => {
  projectTableDateParms.value.pageSize = val
  projectTableDateMethods()
}

const handleCurrentChange2 = (val: number) => {
  projectTableDateParms.value.pageNum = val
  projectTableDateMethods()
}

// 基础资料建档
const HolidayInquiryParms = ref({
  pageNum: 1,
  pageSize: 40
})

const totalA = ref(0)

const HolidayInquiryTableDateList = ref([])

const HolidayInquiryMethods = async () => {
  const result = await HolidayInquiry(HolidayInquiryParms.value)
  HolidayInquiryTableDateList.value = result.dtos.map((item: any) => {
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  totalA.value = result.total
  isLoading3.value = false
}

const handleSizeChange1 = (val: number) => {
  HolidayInquiryParms.value.pageSize = val
  HolidayInquiryMethods()
}

const handleCurrentChange1 = (val: number) => {
  HolidayInquiryParms.value.pageNum = val
  HolidayInquiryMethods()
}

// 成型生产线资料定义 查询

// 学习曲线查询
const learningCurveDateTableDate = ref([])

const learningCurveDateMethods = async () => {
  const result = await learningCurveDate()
  learningCurveDateTableDate.value = result.map((item: any) => {
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  isLoading1.value = false
}

// IE数据查询
const styleDateListParms = ref({
  pageNum: 1,
  pageSize: 40
})

const totalList = ref(0)

const styleDateListTableDateList = ref([])

const styleDateListMethods = async () => {
  const result = await styleDateList(styleDateListParms.value, styleList.value)
  styleDateListTableDateList.value = result.dtos.map((item: any) => {
    item.change = 'Y'
    item.disableConfirm = true
    return item
  })
  totalList.value = result.total
  isLoading2.value = false
}

const handleSizeChange = (val: number) => {
  styleDateListParms.value.pageSize = val
  styleDateListMethods()
}

const handleCurrentChange = (val: number) => {
  styleDateListParms.value.pageNum = val
  styleDateListMethods()
}

onMounted(() => {
  ProductionLineDataMethods()

  styleDateListMethods()

  learningCurveDateMethods()

  HolidayInquiryMethods()

  projectTableDateMethods()

  lineTableDateMehtods()

  HourQueryMehtods()
})

const WorkshopNameArrayList = ref<any>([])

const ProductionLineDataTableDateList = ref([])

const ProductionLineDataMethods = async () => {
  WorkshopNameArray.value = []
  const result = await ProductionLineData()
  ProductionLineDataTableDateList.value = result.map((item: any) => {
    item.change = 'Y'
    item.disableConfirm = true
    WorkshopNameArray.value.push(item.line)
    return item
  })
  if (WorkshopNameArrayList.value.length > 0) {
    lineListArray.value = WorkshopNameArrayList.value[0].optionValue
    progressQueryListMethods()
  }

  formList2.value[2].selectOptions = EvaluatesTheArrayReturnValue(WorkshopNameArray.value)
  WorkshopNameArrayList.value = EvaluatesTheArrayReturnValue(WorkshopNameArray.value)
  isLoading7.value = false
  isLoading9.value = false
}

// 导航栏
const navItems = ref(['基础资料建档', '进度安排', '进度查询'])

// 导航栏状态
const isActive = ref(0)

const formList = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入指令',
    inputValue: ''
  },
  {
    type: 'select',
    selectValue: '',
    selectLabel: '',
    selectOptions: [],
    selectP: '型体'
  },
  {
    type: 'date',
    dateLabel: '交期日期',
    dateValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '更新指令'
  },
  {
    type: 'button',
    checkboxLabel: '指令结束'
  },
  {
    type: 'button',
    checkboxLabel: '指令恢复'
  },
  {
    type: 'button',
    checkboxLabel: '查看结束指令'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  },

  {
    type: 'button',
    checkboxLabel: '批量移线'
  },
  {
    type: 'button',
    checkboxLabel: '批量改序号'
  },
  {
    type: 'button',
    checkboxLabel: '计算进度表'
  },
  {
    type: 'button',
    checkboxLabel: '导出进度表 '
  },
  {
    type: 'button',
    checkboxLabel: '导出周预排 '
  },
  {
    type: 'input',
    inputPlaceholder: '请输入指令',
    inputValue: ''
  },
  {
    type: 'input',
    inputPlaceholder: '请输入型体',
    inputValue: ''
  }
])

const formList1 = ref([
  {
    type: 'select',
    selectValue: '',
    selectLabel: '',
    selectOptions: [],
    selectP: '生产线'
  },
  {
    type: 'input',
    inputPlaceholder: '请输入指令',
    inputValue: ''
  },
  {
    type: 'select',
    selectValue: '',
    selectLabel: '',
    selectOptions: [],
    selectP: '型体'
  },
  {
    type: 'date',
    dateLabel: '交期',
    dateValue: ''
  },
  {
    type: 'date',
    dateLabel: '开始日期',
    dateValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
])

const formList2 = ref([
  {
    type: 'input',
    inputPlaceholder: '请输入型体',
    inputValue: ''
  },
  {
    type: 'button',
    checkboxLabel: '插入下一个月周日日期'
  },
  {
    type: 'select',
    selectLabel: '',
    selectOptions: [],
    selectP: '大类',
    selectValue: ''
  },
  {
    type: 'dateSingle',
    dateLabel: '日期',
    dateValue: ''
  },
  {
    type: 'input',
    inputValue: '',
    inputPlaceholder: '请输入月 例如:202305'
  },
  {
    type: 'button',
    checkboxLabel: '插入一个月日排量资料'
  },
  {
    type: 'button',
    checkboxLabel: '置空',
    bgColor: '#1890FF'
  }
])

// 表格数据

const tableHeader5 = ref([
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '车间代码',
    prop: 'workshop'
  },
  {
    label: '车间名称',
    prop: 'workshopName'
  },
  {
    label: '生产线名称',
    prop: 'line'
  },
  {
    label: '日产能(双)',
    prop: 'ieQty'
  },
  {
    label: '人数',
    prop: 'persons'
  }
])

const tableHeader11 = ref([
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '从',
    prop: 'dayFrom'
  },
  {
    label: '到',
    prop: 'dayTo'
  },
  {
    label: '排量%',
    prop: 'percent'
  },
  {
    label: '第一次投量日期',
    prop: 'beginDate'
  }
])

const tableHeader3 = ref([
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '成型日产能',
    prop: 'ieQty'
  }
])

const tableHeader2 = ref([
  {
    label: '日期',
    prop: 'holidayDate'
  }
])

const tableHeader6 = ref([
  {
    label: '线别',
    type: 'select',
    prop: 'line'
  },
  {
    label: '客户',
    prop: 'custom'
  },
  {
    label: '品牌',
    prop: 'brand'
  },
  {
    label: '系列',
    prop: 'productType'
  }
])

const tableHeader7 = ref([
  {
    label: '生产线',
    type: 'select',
    prop: 'line'
  },
  {
    label: '日期',
    prop: 'ddate'
  },
  {
    label: '排量%',
    prop: 'percent'
  }
])

const tableHeader15 = ref([
  {
    label: '生产线',
    prop: 'optionValue'
  }
])

const tableHeader8 = ref([
  {
    label: '冲刀完成时程门槛',
    prop: 'cut1MtlLt'
  },
  {
    label: '面材配套时程门槛',
    prop: 'cut2MtlLt'
  },
  {
    label: '冲裁配套时程门槛',
    prop: 'cut4MtlLt'
  },
  {
    label: '针车时程门槛',
    prop: 'stitchMtlLt'
  },
  {
    label: '大底时程门槛',
    prop: 'soleMtlLt'
  }
])

// 表格数据

const tableHeader = ref([
  {
    label: '安排日期',
    prop: 'scheduleNo'
  },
  {
    label: '生产线',
    prop: 'line'
  },
  {
    label: '序号',
    prop: 'seqNo'
  },
  {
    label: '指令',
    prop: 'lotNo'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '颜色',
    prop: 'color'
  },
  {
    label: '订单量',
    prop: 'orderQty'
  },
  {
    label: '交期',
    prop: 'deliveryDate'
  },
  {
    label: '安排数量',
    prop: 'scheduleQty'
  },
  {
    label: 'IE日产能',
    prop: 'stdQty'
  },
  {
    label: '生产天数',
    prop: 'prodDays'
  },
  {
    label: '开始日期',
    prop: 'beginDate'
  },
  {
    label: '结束日期',
    prop: 'beginDate'
  }
])

const tableHeaderOuder = ref([
  {
    label: '指令',
    prop: 'lotNo'
  },
  {
    label: '型体',
    prop: 'style'
  },
  {
    label: '楦头',
    prop: 'lastNo'
  },
  {
    label: '颜色',
    prop: 'color'
  },
  {
    label: '交货期日',
    prop: 'deliveryDate'
  },
  {
    label: '订单数量',
    prop: 'orderQty'
  },
  {
    label: '待排数量',
    prop: 'unSchQty',
    width: '55'
  },
  {
    label: '完工数量',
    prop: 'inQty'
  },
  {
    label: '成型欠数',
    prop: 'unInQty'
  },
  {
    label: '配套库存',
    prop: 'matchStock'
  }
])

const tableHeader1 = ref([
  {
    label: '生产线',
    prop: 'line',
    change: true
  },
  {
    label: '序号',
    prop: 'seqNo',
    change: true
  },
  {
    label: '指令',
    prop: 'lotNo',
    change: true
  },
  {
    label: '型体',
    prop: 'style',
    change: true
  },
  {
    label: '楦头',
    prop: 'lastNo',
    change: true
  },
  {
    label: '颜色',
    prop: 'color',
    change: true
  },
  {
    label: '安排数量',
    prop: 'scheduleQty',
    change: true
  },
  {
    label: 'IE日产能',
    prop: 'stdQty'
  },
  {
    label: '生产天数',
    prop: 'prodDays',
    change: true
  },
  {
    label: '开始日期',
    prop: 'beginDate',
    change: true
  },
  {
    label: '结束日期',
    prop: 'endDate',
    change: true
  },
  {
    label: '指令交期',
    prop: 'deliveryDate',
    change: true
  }
])

//点击切换
const clickToSwitch = (index: number) => {
  isActive.value = index
  if (index === 2) {
    progressQueryMethods()
    styleQueryMethods()
    formList1.value[0].selectOptions = EvaluatesTheArrayReturnValue(WorkshopNameArray.value)
  }
  if (index === 1) {
    OrderInformationInquiryMethods()
    styleQueryMethods()
  }
}

// 分页器
const currentPage = ref(1)

const pageSize = ref(10)

const total = ref(658)
</script>

<style lang="less" scoped>
.ProductionDynamicMain {
  display: flex;
}

.table1 {
  :deep(th:nth-child(5)) {
    color: red !important;
  }

  :deep(th:nth-child(6)) {
    color: red !important;
  }
}

.H1Size {
  font-size: 16px;
}

.bottom {
  float: right;
}

.DynamicCondition {
  color: #f89027;
  border-bottom: 2px solid #f89027;
}

.spacing {
  margin-left: 10px;
  /* 根据需要调整间距大小 */
}

// 底部
.bottom {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5rem;

  .total {
    font-size: 16px;
  }

  .save {
    background-color: #e7e7e7;
    border: #e7e7e7;
    color: black;
  }

  :deep(.is-active.number) {
    background-color: #f89027 !important;
    color: white;
    border-radius: 3px 3px 3px 3px;
  }

  :deep(.number) {
    border: 1px solid #dcdcdc;
    margin-right: 8px;
    border-radius: 3px 3px 3px 3px;
  }
}

.Header {
  margin-top: 16px;
  display: flex;
}
</style>
